﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using WebApplication1.App_Start;
using WebApplication1.App_Start.Attributes;

namespace WebApplication1.Controller
{
    public class HomeController:BaseController
    {
        public IResult Init(string Value,int age)
        {
            //var value1 = GetIntValue().Result;
            //var value2 = Sum().Result;
            var value3 = GetString().Result;
            return Content("初始化中........" );
        }
        public IResult Index(Model model)
        {
            return View("Index");
        }
        [Exception("出现异常了")]
        public IResult Contact()
        {
            throw new Exception("异常啦");
            //return View();
        }
        public IResult GetFile()
        {
            return FileResult(Path.Combine(@"C:\Users\Administrator\Desktop\2017年度话费开发部工作计划表.docx"));
        }

        private async Task<int> GetIntValue()
        {
            return await Task.Run(() => DateTime.Now.Second);
        }
        private async Task<int> Sum()
        {
             return await Task.Run(() => GetIntValue().Result + 100);
        }
        private async Task<String> GetString()
        {
            await GetIntValue();
            await Sum();
            return await Task.Run(() => "...");
        }

    }
    public class Model
    {
        public string Name { get; set; }
        public int Age { get; set; }
    }

    
}